package com.corpdata.app.project.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.corpdata.core.base.AbstractBaseService;
import com.corpdata.app.project.dao.ProjectFieldMapper;
import com.corpdata.app.project.entity.ProjectField;
import com.corpdata.app.project.entity.ProjectFieldTeam;
import com.corpdata.app.project.entity.ProjectInfo;
import com.corpdata.app.project.service.ProjectFieldService;
import com.corpdata.common.result.Result;
import com.corpdata.common.upload.service.SysAttachmentService;
import com.corpdata.common.utils.CorpdataUtil;

/**
 * 分店场地
 * 
 * @author wu
 * @email 64088839@qq.com
 * @date 2018-07-16 11:00:04
 */
@Service
@Transactional
public class ProjectFieldServiceImpl extends AbstractBaseService<ProjectField> implements ProjectFieldService {
	
	@Autowired
	private ProjectFieldMapper projectFieldMapper;
	
	@Autowired
	private SysAttachmentService sysAttachmentService;
	
	/**
	 * 获取下拉json数据
	 * @return
	 */
	public String selectAllByCombox(String id){
		String json = CorpdataUtil.getComboxJson(projectFieldMapper.selectAllByCombox(id));
		return json;
	}
	
	public Result insert(ProjectField record,String fileId){
		sysAttachmentService.updateDel(fileId,record.getId());
		return super.save(record);
	}
	public Result update(ProjectField record,String fileId){
		sysAttachmentService.updateDel(fileId,record.getId());
		return super.update(record);
	}
}
